package wsc.mcis.androidDevelpment;

import java.util.ArrayList;

import android.app.Activity;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.Button;
import android.widget.ListView;
import android.widget.Toast;

public class ResumeSheetActivity extends ListActivity {
  public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    ArrayList<RMBLListItem> values = new ArrayList<RMBLListItem>();

    values.add(new RowListItem("Row1","flowers",0));
    values.add(new RowListItem("Row2","flowers",1));
    values.add(new RowListItem("Row3","flowers",2));
    
    View footer = getLayoutInflater().inflate(R.layout.list_view_footer, null);
    ListView listView = getListView();
    listView.addFooterView(footer);
    
    Button button =(Button)findViewById(R.id.button_new);
    button.setText(R.string.button_text_new_row);
    button.setOnTouchListener(new OnTouchListener(){

        @Override
        public boolean onTouch(View v, MotionEvent event) {

          Intent startMe;
          
          startMe = new Intent(ResumeSheetActivity.this,NewRowActivity.class);
          startActivity(startMe);
          
          return false;
        }
    });
    
    PerformanceArrayAdapter adapter = new PerformanceArrayAdapter(this, values);
    setListAdapter(adapter);
  }

  @Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
    RowListItem item = (RowListItem) getListAdapter().getItem(position);
    Toast.makeText(this, item.rowID + " selected", Toast.LENGTH_LONG).show();
   
    Intent startMe;
    
    startMe = new Intent(ResumeSheetActivity.this,EditRowActivity.class);
    startMe.putExtra("rowID", item.rowID);
    startActivity(startMe);
    
    
    
  }

}
